#pragma once

#include <string>

#define REGISTER_CONTAINER_CREATOR(id, code) static Container* CONTAINER_CREATOR_ ## id () { \
    code; \
} 
#define GET_CONTAINER_CREATOR(id) CONTAINER_CREATOR_ ## id
#define DELETE_AND_NULL(v) if (v) { delete v; v = NULL; }
#define CHECK_CONTAINER_AND_RETURN(as, els) if (m_container) return m_container->as(); else return els;

namespace db 
{
    class Container;
    class WriteStream;
    class ReadStream;


    static const std::wstring V_TRUE = L"true";
    static const std::wstring V_FALSE = L"false";

    typedef Container* (*CONTAINER_CREATOR)();

    class FileHelper
    {
    public:
        static bool write_wstring(WriteStream& file, const std::wstring& data);
        static bool read_wstring(ReadStream& file, std::wstring& data);
    };
}